package com.dingding.commonservice.core.vehicle.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.dingding.common.core.base.daox.ISQLBaseDao;
import com.dingding.common.core.beans.carinfo.CarBrandInfo;
import com.dingding.common.core.beans.carinfo.CarModelInfo;
import com.dingding.commonservice.core.vehicle.dao.IVehicleDao;
import com.dingding.commonservice.core.vehicle.sql.VehicleSQL;

/**
 * 
 * @ClassName: VehicleDaoImpl 
 * @Description: 车辆DAO实现类
 * @author YHQ
 * @date 2016年12月3日 下午4:07:02
 * @since V2.5.7
 * 
 */
@Component("vehicleDao")
public class VehicleDaoImpl implements IVehicleDao {

	private Logger log = Logger.getLogger(this.getClass());
	
	@Resource(name = "SQLBaseDao")
	private ISQLBaseDao sqlBaseDao;

	/**
	 * 
	 * @Title: getCarBrandInfoList 
	 * @Description: 获取车辆品牌列表
	 * @author YHQ 
	 * @since V2.5.7
	 * @return List<CarBrandInfo>    返回类型
	 * 
	 */
	@Override
	@Transactional(readOnly = true)
	public List<CarBrandInfo> getCarBrandInfoList() {
		
		try {
			// 获取车辆品牌列表
			return sqlBaseDao.listSqlToCustomBean(CarBrandInfo.class, VehicleSQL.GET_VEHICLE_BRAND_LIST);
		} catch (Exception e) {
			log.error("获取车辆品牌列表时出现异常  类：" + this.getClass() + " getCarBrandInfoList()", e);
		}
		
		return null;
	}

	/**
	 * 
	 * @Title: getCarModelInfoList 
	 * @Description: 获取车辆型号列表
	 * @author YHQ 
	 * @since V2.5.7
	 * @return List<CarBrandInfo>    返回类型
	 * 
	 */
	@Override
	@Transactional(readOnly = true)
	public List<CarModelInfo> getCarModelInfoList() {
		
		try {
			// 获取车辆类型列表
			return sqlBaseDao.listSqlToCustomBean(CarModelInfo.class, VehicleSQL.GET_VEHICLE_MODEL_LIST);
		} catch (Exception e) {
			log.error("获取车辆型号列表时出现异常   类：" + this.getClass() + " getCarModelInfoList()", e);
		}
		
		return null;
	}
	
}
